#include<iostream>
#include<string>
#include<stack>
#include<algorithm>

class Solution {
public:
    std::string removeDuplicates(std::string str) {
        std::stack<char> st;
        for(char s : str){
            if(st.empty() || s != st.top()){
                st.push(s);
            }
            else{
                st.pop();
            }
        }
        std::string result = "";
        while(!st.empty()){
            result += st.top();
            st.pop();
        }
        reverse(result.begin(), result.end());
        return result;
    }
};

int main()
{
    Solution s;
    std::string str;
    std::cin >> str;
    std::cout << s.removeDuplicates(str) << std::endl;
    return 0;
}